package com.carp.springframework.processor;

import com.carp.springframework.bean.UserService;
import com.carp.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author lile
 * @date 2023/2/17
 */
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        if ("userService".equals(beanName)) {
            ((UserService) bean).setLocation("中国(改)");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) {
        return bean;
    }
}
